package cn.edu.sdyu.ie.crs.common.util;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

public class DateTimeUtil {

    /**
     * 获取当前周日期序列
     * @return
     */
    public static List<LocalDate> getDaysOfWeek() {
        int todayOfWeek = LocalDate.now().getDayOfWeek().getValue();
        LocalDate monday =  LocalDate.now().minusDays(todayOfWeek - 1);

        List<LocalDate> daysOfWeek = new ArrayList<>();
        for(int i=0; i<7; i++) {
            daysOfWeek.add(monday.plusDays(i));
        }

        return daysOfWeek;
    }
}
